package org.streamerstudio.ui.preferences;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.List;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.custom.SashForm;

public class TargetPlatformPreferences extends PreferencePage {

	/**
	 * Create the preference page.
	 */
	public TargetPlatformPreferences() {
		setDescription("Add, edit and remove target definition.");
		setTitle("Target Definition");
	}

	/**
	 * Create contents of the preference page.
	 * @param parent
	 */
	@Override
	public Control createContents(Composite parent) {
		Composite container = new Composite(parent, SWT.NULL);
		container.setLayout(new GridLayout(2, false));
		// -- component creation
		SashForm sashForm = new SashForm(container, SWT.VERTICAL);
		sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
		// -- component creation
		TreeViewer targetsViewer = new TreeViewer(sashForm, SWT.BORDER | SWT.CHECK);
		Tree tree = targetsViewer.getTree();
		// -- component creation
		ListViewer locationsViewer = new ListViewer(sashForm, SWT.BORDER);
		List list = locationsViewer.getList();
		sashForm.setWeights(new int[] {219, 102});
		// -- component creation
		Button addButton = new Button(container, SWT.NONE);
		addButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
		addButton.setText("Add...");
		// -- component creation
		Button editButton = new Button(container, SWT.NONE);
		editButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
		editButton.setText("Edit...");
		// -- component creation
		Button removeButton = new Button(container, SWT.NONE);
		removeButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
		removeButton.setText("Remove");
		new Label(container, SWT.NONE);

		return container;
	}

	/**
	 * Initialize the preference page.
	 */
	public void init(IWorkbench workbench) {
		// Initialize the preference page
	}

}
